//
//  CJYCAlertCell.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/6/14.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "CJYCAlertCell.h"

@implementation CJYCAlertCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubView];
    }
    return self;
}
- (void)initSubView{
    CGFloat W = 1.0/4;
    UILabel *contLab = [UILabel new];
    for (int i = 0; i<4; i++) {
        if (i == 0) {
            UILabel *label = [[UILabel alloc]init];
            label.textAlignment = 1;
            label.textColor = TITLECOLOR;
            label.font = [UIFont systemFontOfSize:15];
            [self addSubview:label];
            label.tag = 30+i;
            contLab = label;
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(@0);
                make.top.equalTo(@0);
                make.width.equalTo(self).multipliedBy(W);
                make.height.mas_equalTo(50);
            }];
        } else {
            UILabel *label = [[UILabel alloc]init];
            label.textAlignment = 1;
            label.textColor = TITLECOLOR;
            label.font = [UIFont systemFontOfSize:15];
            label.tag = 30+i;
            [self addSubview:label];
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(contLab.mas_right);
                make.top.equalTo(@0);
                make.width.equalTo(self).multipliedBy(W);
                make.height.mas_equalTo(50);
            }];
            contLab = label;
        }
    }
}
- (void)reloadView:(NSArray *)array{
    for (int i =0; i<array.count; i++) {
        UILabel *label = (UILabel *)[self viewWithTag:i+30];
        label.text = array[i];
    }
}
- (void)drawRect:(CGRect)rect{
    UIBezierPath *path = [[UIBezierPath alloc]init];
    [path moveToPoint:CGPointMake(0,50)];
    [path addLineToPoint:CGPointMake(500, 50)];
    [LINCOLOR set];
    [path stroke];
    CGFloat W = 500.0/4.0;
    for (int i = 1; i<4; i++) {
        UIBezierPath *pathNext =[[UIBezierPath alloc]init];
        [pathNext moveToPoint:CGPointMake(W*i,0)];
        [pathNext addLineToPoint:CGPointMake(W*i, 50)];
        [LINCOLOR set];
        [pathNext stroke];
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
